import { constantRoutes } from '@/router'

const state = {
    routes: [],
    addRoutes: [],
    currentRoutes: {}
}

const mutations = {
    SET_ROUTES: (state, routes) => {
        state.addRoutes = routes
        state.routes = constantRoutes.concat(routes)
    },
    SET_CURRENT_ROUTES: (state, routes) => {
        // console.log("更改默认第一个", routes);
        let routesNew = JSON.parse(JSON.stringify(routes))
        routesNew.children[0].meta.select = routesNew.children[0].meta.iconActive
        state.currentRoutes = routesNew
    },
    SET_CURRENT_ROUTES_NEW: (state, routes) => {
        state.currentRoutes = routes
    }
}

export default {
    namespaced: true,
    state,
    mutations
}